# -*- coding: utf-8 -*-
# @Time    : 2022/7/16 11:40
# @Author  : haichuan
# @Email   : 2263126410@163.com
# @File    : xtbs_grzl_chakpage.py
# @Software: PyCharm

from selenium.webdriver.common.by import By
from pages.denglu_page import Deng_BasePage





class ChakGrzlPage(Deng_BasePage):
    '''查看个人资料'''
    url = "http://192.168.12.1/crm/"
    login_name = (By.NAME, 'name')
    login_password = (By.NAME, 'password')
    login_ptn = (By.NAME, 'submit')
    user_Heads = (By.CSS_SELECTOR, 'li.dropdown:nth-child(6) > a:nth-child(1)')
    My_panel = (By.CSS_SELECTOR, 'li.dropdown:nth-child(6) > ul:nth-child(2) > li:nth-child(3) > a:nth-child(1)')

    def name_user(self,user_name):
        # 用户名
        self.driver.find_element ( *self.login_name).send_keys (user_name)

    def password_user(self,user_password):
        # 密码
        self.driver.find_element(*self.login_password).send_keys(user_password)

    def jr_ptn(self):
        # 登录按钮
        self.driver.find_element(*self.login_ptn).click()

    def cilck_tx(self):
        # 点击头像
        self.driver.find_element(*self.user_Heads).click()

    def cilck_grzl(self):
        # 点击个人资料
        self.driver.find_element(*self.My_panel).click()

    def chack_grzl(self, username, password):
        # 查看个人资料操作
        self.open()
        self.name_user(username)
        self.password_user(password)
        self.jr_ptn()
        self.cilck_tx()
        self.cilck_grzl()












